<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class FakeRank extends Model
{
    public $timestamps = false;

    protected $table = 'fake_rank';

    public function getDataAttribute($data)
    {
        return json_decode($data, true);
    }

    public function getGoodsCount()
    {
        $rows = $this->attributesToArray();
        unset($rows['id'], $rows['type']);
        return array_sum($rows);
    }
}
